module PagesHelper
  def page_name_value
    if action_name == "show" 
      h @page.name 
    else
      value  = @page.name 
      text_field_tag "page[name]", value
    end
  end
  
  def page_url_value
    if action_name == "show" 
      h @page.url
    else
      value  = @page.url
      text_field_tag "page[url]", value
    end
  end
  
  def page_body_value
    if action_name =="show"
      @page.body
    else
      text_area_tag "page[body]", @page.body
    end
  end

  def page_is_enabled_value
    if action_name =="show"
      h @page.is_enabled
    else
      check_box "page", "is_enabled", {:class => "chkbox"} 
    end
  end

  def page_is_featured_value
    if action_name =="show"
      h @page.is_featured 
    else
      check_box "page", "is_featured", {:class => "chkbox"} 
    end
  end

  def page_show_in_footer_value
    if action_name =="show"
      h @page.show_in_footer 
    else
      check_box "page", "show_in_footer", {:class => "chkbox"} 
    end
  end
  
  def page_folder_value
    if action_name == "show"
      unless @page.folder.nil?        
        h @page.folder.name
      else
         "No folder."
       end  
     else
       select "page", "folder_id", Folder.find(:all).map { |f| [ f.qualified_name, f.id ] }, { :include_blank => true }
     end
   end

end
